import { _decorator, CCBoolean, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('LotteryItem')
export class LotteryItem extends Component {
    @property()
    index: number = 0;
    @property(Node) 
    awardIcon: Node = null!;
    @property(Node)
    lightNode: Node = null!;
    // 是否高亮
    @property({ type: CCBoolean }) isAward: boolean = false;

    public showAward() {
        this.awardIcon.active = true;
        if (this.isAward) {
            this.lightNode.active = true;
            console.log("抽中角色" + this.node.name);
        }
    }

    /** 隐藏奖励面板 */
    public hideAward() {
        this.lightNode.active = false;
        this.awardIcon.active = false;
    }

    public showLight(delayTime: number = 0) {
        this.lightNode.active = true;
        this.scheduleOnce(() => {
            this.lightNode.active = false;
        }, 0.1);
    }

}


